package com.fwtai.controller.web;

import com.fwtai.service.web.EditorService;
import com.fwtai.tool.ToolClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * KindEditor富文本编辑器图片上传处理
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2021/12/9 11:40
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@RestController
@RequestMapping("/editor")
public class EditorController{

    @Autowired
    private EditorService editorService;

    @PostMapping("/upload")
    public void upload(final HttpServletRequest request,final HttpServletResponse response){
        ToolClient.responseJson(editorService.upload(request),response);
    }

    @GetMapping("/getFiles")
    public void getFiles(final HttpServletRequest request,final HttpServletResponse response){
        ToolClient.responseJson(editorService.getFiles(request),response);
    }
}